{	Problem: http://codeforces.ru/problemset/problem/90/B
	Verdict: Accepted
}
var
    i,j,k,n,m:longint;
    f:boolean;
    a:array[0..110,0..110] of char;
    ch:char;
    ans:string;

begin
readln(n,m);
for i:=1 to n do begin
    for j:=1 to m do
        read(a[i][j]);
    readln;
end;
ans:='';
for i:=1 to n do
    for j:=1 to m do begin
        ch:=a[i][j];
        f:=true;
        for k:=1 to m do
            if (a[i][k]=ch) and (j<>k) then begin
                f:=false;
                break;
            end;
        if f then begin
            for k:=1 to n do    
                if (k<>i) and (a[k][j]=ch) then begin
                    f:=false;
                    break;
                end;
            if f then ans:=ans+ch;
        end;
    end;
write(ans);
end.